#ifndef _BLDC_TYPE_H
#define _BLDC_TYPE_H

typedef enum{
    PHASE1 = 0,
    PHASE2,
    PHASE3,
    PHASE4,
    PHASE5,
    PHASE6,
    PHASE_ERROR,
}BldcPhase_t;

typedef enum{
    PhaseSwitch,//换向
    DEventDelay,//避开换向退磁
    ZPointDetect,//检测过零点
    FVIncrement,//升频(F)升压(V)
    SensorlessStart,//切无感
    ForceRunSentinal,//哨兵
}ForceRunState_t;//强拖状态

typedef struct
{
    BldcPhase_t ePhase;//当前扇区
    uint16_t u16HallVal;//霍尔组合值
    uint16_t phaseTime;//换向间隔计数瞬时值
    uint16_t phaseTimeBuffer[6];//6次换向计数值缓存
    uint16_t phaseTimeCnt;//换向计数缓存个数
    uint16_t OneEPeriodUpdated;//6次换向计数值缓存满标志位
}BldcRunState_t;

typedef struct 
{
    uint8_t deMagnezationCnt;//退磁计数器
    uint16_t ForceRunPhaseTimeBase;//强拖换向时间基准值，单位ms
    uint16_t ForceRunPhaseTimeCnt;//强拖换向时间计数器，单位ms
    uint16_t ForceRunOutTerminalVoltage;
}SensorlessInfo_t;//无感相关参数

#endif
